﻿@using Senparc.Weixin.Open.ComponentAPIs
@*DPBMARK_FILE Open*@
@{
    Layout = null;

    var authInfo = ViewData["QueryAuthorizationInfo"] as AuthorizationInfo;
    var autherInfo = ViewData["GetAuthorizerInfoResult"] as AuthorizerInfo;

    if (autherInfo == null)
    {
        throw new Exception("SS");
    }
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>成功授权</title>
</head>
<body>
    <h1>账号已成功授权</h1>
    <section>
        <h2>授权信息</h2>
        <p>authorizer_access_token：@authInfo.authorizer_access_token</p>
        <p>authorizer_appid：@authInfo.authorizer_appid</p>
        <p>authorizer_refresh_token：@authInfo.authorizer_refresh_token</p>
        <p>expires_in：@authInfo.expires_in</p>
        <p>
            func_info：<br />
            @if (authInfo.func_info != null)
            {
                foreach (var item in authInfo.func_info)
                {
                    <span>&nbsp; &nbsp; @(item.funcscope_category != null ? item.funcscope_category.id.ToString() : "空（异常情况）")</span><br />
                }
            }
            else
            {
                <span>空（异常情况）</span>
            }
        </p>
    </section>
    <section>
        <h2>授权公众号信息</h2>
        <p>
            <img src="@autherInfo.head_img" style="width: 100px;" />
            <img src="@autherInfo.qrcode_url" style="width: 100px;" />
        </p>
        <p>alias：@autherInfo.alias</p>
        <p>nick_name：@autherInfo.nick_name</p>
        <p>user_name：@autherInfo.user_name</p>
        <p>service_type_info：@autherInfo.service_type_info.id</p>
        <p>verify_type_info：@autherInfo.verify_type_info.id</p>
        <h2>授权信息</h2>
        <p>appid：@authInfo.authorizer_appid</p>
    </section>
    <section>
        <h2>查看授权缓存信息</h2>
        <p>
            @Html.ActionLink("点击查看", "GetAuthorizerInfoResult", "OpenOAuth", new { authorizerId = authInfo.authorizer_appid }, new { target = "_blank" })<br />
        </p>
        <p>
            @Html.ActionLink("刷新AuthorizerAccessToken", "RefreshAuthorizerAccessToken", "OpenOAuth", new { authorizerId = authInfo.authorizer_appid }, new { target = "_blank" })<br />
        </p>
    </section>
    <section>
        <h2>用户授权测试</h2>
        <p>

            @Html.ActionLink("点击开始用户授权测试", "Index", "OpenOAuth", new { appId = authInfo.authorizer_appid }, null)<br />
            注意：测试之前请先确认您的公众号有OAuth的权限，否则可能会返回错误：Scope 参数错误或没有 Scope 权限。
        </p>
    </section>

</body>
</html>
